package controller.admin.setmeal;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import model.DTO.SetmealEditDTO;
import service.Impl.SetmealServiceImpl;
import util.GetJsonUtil;
import util.ResultUtil;

import java.io.IOException;

@WebServlet("/admin/setmeal")
public class SetmealEditController extends HttpServlet {
    //修改套餐
    @Override
    protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        SetmealEditDTO setmeal= (SetmealEditDTO) GetJsonUtil.get(req,new SetmealEditDTO());
        SetmealServiceImpl ss=new SetmealServiceImpl();
        ss.edit(setmeal);
        String json=ResultUtil.getJSON(null);
        resp.getWriter().println(json);
    }
}
